﻿using System;
using System.Windows.Forms;
using AutoMapper;
using VMWorkshop.Domain;
using VMWorkshop.WinForms.Views;

namespace VMWorkshop.WinForms
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            CreateMappings();
            Application.Run(new Demo());
        }

        public static void CreateMappings()
        {
            Mapper.CreateMap<Product, ProductListView>();

            Mapper.CreateMap<Product, Product>()
                .ForMember(dto => dto.CreatedBy, opt => opt.UseDestinationValue())
                .ForMember(dto => dto.CreatedOn, opt => opt.UseDestinationValue())
                .ForMember(dto => dto.ModifiedBy, opt => opt.UseDestinationValue())
                .ForMember(dto => dto.ModifiedOn, opt => opt.UseDestinationValue())
                ;
        }
    }
}
